#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2022-5-2 13:40

# 二次封装requests，对请求进行定制化
import requests
import yaml


class EnvApi:
    env = yaml.safe_load(open('env.yaml'))

    def send(self, data:dict):
        data['url'] = str(data['url']).replace("env_string", self.env['env_string'][self.env['default']])
        return requests.request(method=data['method'], url=data['url'], headers=data['headers'])
